package cn.iocoder.yudao.module.lowcode.controller.admin.datasource.vo;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

@Schema(description = "管理后台 - 数据源配置新增/修改 Request VO")
@Data
public class DatasourceConfigSaveReqVO {

    @Schema(description = "数据源编号", example = "1")
    private Long id;

    @Schema(description = "数据源名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "主数据库")
    @NotBlank(message = "数据源名称不能为空")
    @Size(max = 50, message = "数据源名称长度不能超过50个字符")
    private String name;

    @Schema(description = "数据库类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "mysql")
    @NotBlank(message = "数据库类型不能为空")
    private String type;

    @Schema(description = "JDBC连接URL", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "JDBC连接URL不能为空")
    private String url;

    @Schema(description = "用户名", requiredMode = Schema.RequiredMode.REQUIRED, example = "root")
    @NotBlank(message = "用户名不能为空")
    private String username;

    @Schema(description = "密码")
    private String password;

    @Schema(description = "JDBC驱动类名", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "JDBC驱动类名不能为空")
    private String driverClassName;

    @Schema(description = "初始化连接数", example = "1")
    private Integer initialSize;

    @Schema(description = "最小空闲连接数", example = "1")
    private Integer minIdle;

    @Schema(description = "最大活动连接数", example = "8")
    private Integer maxActive;

    @Schema(description = "用于检测连接是否有效的SQL", example = "SELECT 1")
    private String testQuery;

    @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
    @NotNull(message = "状态不能为空")
    private Integer status;
}